﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace GovernmentOfficeProject.LevelDataAccessModel
{
    public class TreeMenu
    {
        public decimal id;
        public string MenuNo;
        public string MenuName;
        public string url;
        public List<TreeMenu> childrens = new List<TreeMenu>();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="treeNode"></param>
        /// <returns></returns>
        public static TreeMenu getNodeByName(string name,TreeMenu treeNode)
        {
            if (treeNode.MenuNo == name){
                return treeNode;
            }

            foreach (TreeMenu tm in treeNode.childrens){
                if(tm.MenuNo == name){
                    return tm;
                }
            }
            return null;
        }
    }
}
